Skip to content

Feature/vikingbot_opt: OpenAPI interface standardization;Feishu multi-user experience; observability enhancements; configuration system modernization.#419

Merged
MaojiaSheng merged 56 commits intomainfrom
feature/vikingbot_opt
Mar 4, 2026
Merged

Feature/vikingbot_opt: OpenAPI interface standardization;Feishu multi-user experience; observability enhancements; configuration system modernization.#419
MaojiaSheng merged 56 commits intomainfrom
feature/vikingbot_opt

Conversation

@chenjw
Copy link
Collaborator

@chenjw chenjw commented Mar 4, 2026

Description

PR Summary: Vikingbot Architecture Optimization & Feature Enhancement

📊 Change Overview

  • 85 files modified
  • +7,026 / -2,336 lines changed
  • 43 commits (non-merge commits)

🚀 Major Features

  1. New OpenAPI Channel (HTTP API)
  • Added OpenAPIChannel - FastAPI-based HTTP chat interface
  • Supported endpoints:
    • POST /chat - Send message (non-streaming)
    • POST /chat/stream - Streaming response (SSE)
    • GET /health - Health check
    • GET /sessions - Session management
  • Integration with OpenViking Server, supporting Bot API Proxy
  1. Feishu (Lark) Multi-User Support
  • Support for multi-user conversations in group chats
  • Added @mention and @ALL support
  • Message reply thread optimization
  • Image processing and upload improvements
  1. Langfuse Observability Integration
  • New LangfuseClient class for LLM call tracing
  • Support for @observe decorator for automatic tracing
  • Provides trace(), span(), generation() context managers
  • Support for session and user ID propagation
  1. Configuration System Refactoring
  • Config file migration: ~/.vikingbot/config.json → ~/.openviking/ov.conf
  • New config structure: Nested bot field, supporting bot.agents,
    bot.channels, bot.gateway
  • Optional dependencies: Feature-based installation ([langfuse], [feishu],
    [telegram], etc.)
  1. CLI Enhancements
  • New vikingbot chat command - Interactive conversation mode
  • gateway command adds --agent option to control Agent loop
  • Removed TUI-related code (Textual dependency)

This PR represents a major architectural upgrade for Vikingbot, primarily
focusing on OpenAPI interface standardization, Feishu multi-user experience,
observability enhancements, and configuration system modernization.

Related Issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

Additional Notes

chenjw and others added 30 commits March 2, 2026 10:59
- Add ChatChannel for interactive chat with User:/Bot: labels and thinking display
- Add SingleTurnChannel for one-off -m mode with minimal output
- Add StdioChannel for JSON-based IPC with Rust TUI
- Rename 'vikingbot agent' to 'vikingbot chat'
- Add Python 'ov chat' command that proxies to vikingbot chat
- Add Rust 'ov chat' command that proxies to vikingbot chat
- Refactor ChannelManager to support both config and direct channel addition
- Update event types for better thinking/tool_call/tool_result display
- Default session key: cli__chat__default
…ing into feature/vikingbot_opt

# Conflicts:
#	bot/vikingbot/openviking_mount/ov_server.py
- Update feishu, dingtalk, discord, email, qq, slack, telegram, whatsapp
- Add filter in send() to skip thinking/tool_call/tool_result messages
- Only process is_normal_message (RESPONSE type)
…bility

- Add vikingbot/utils/tracing.py with backend-agnostic @trace decorator
- Use ContextVar for session_id propagation through nested calls
- Implement lazy binding to Langfuse via propagate_attributes
- Update AgentLoop._process_message() to use @trace decorator
- Simplify langfuse initialization logging in commands.py
- Add session_id parameter to litellm_provider.chat()
- Clean up redundant code in utils/helpers.py

The trace decorator abstracts observability concerns, allowing future
switching between Langfuse, OpenTelemetry, or other backends without
modifying business logic.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2. support multi users
2. support multi users
2. support multi users
The propagate_attributes function is a module-level export in Langfuse
Python SDK v3, not a method of the Langfuse client instance.

- Import propagate_attributes from langfuse module
- Remove misleading warning when propagate_kwargs is empty
- Reduce log noise by changing info logs to debug

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Standardize terminology and clean up tracing/Langfuse integration:

- Rename sandbox_key to workspace_id across agent, memory, and tools
- Delete deprecated langfuse_decorator.py (superseded by tracing.py)
- Fix Langfuse v3 SDK propagate_attributes usage (module-level function)
- Improve session_id extraction with better signature inspection
- Reduce log noise in Langfuse attribute propagation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2. support multi users
…ing into feature/vikingbot_opt

# Conflicts:
#	bot/vikingbot/agent/loop.py
#	bot/vikingbot/hooks/base.py
Add extract_user_id parameter to @trace decorator to enable user
tracking in Langfuse. This allows grouping traces by user in the UI.

- Add extract_user_id parameter to @trace decorator
- Extract user_id from InboundMessage.sender_id
- Pass user_id to Langfuse propagate_attributes
- Update loop.py to use new lambda style for session_id extraction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
yeshion23333 and others added 24 commits March 3, 2026 16:04
- Change usage to usage_details for Langfuse v3 SDK compatibility
- Add support for cache_read_input_tokens (OpenAI/Anthropic prompt caching)
- Add logger import and debug logging for token reporting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the entire legacy test suite including:
- Unit tests (test_agent, test_bus, test_channels, test_config)
- Integration tests (test_agent_e2e)
- Test fixtures, utilities, and OpenSpec config
- Test runner tools (tester/)

These tests were outdated and no longer maintained. Future testing
should use a modern testing framework.
- Update default config path to ~/.openviking/ov.conf
- Add interactive chat mode examples (--no-markdown, --logs flags)
- Remove VKE deployment guide section
- Update Docker volume mount paths
Add detailed Google-style docstrings to:
- AgentLoop.__init__() - parameters and examples
- AgentLoop._publish_thinking_event() - event publishing
- ToolContext - all attributes documented
- Tool base class - complete usage example

Improves code maintainability and IDE support.
Server changes:
- Add --with-bot flag to enable Bot API proxy
- Register bot_router at /bot/v1 prefix
- Add bot_api_url configuration option
- Initialize bot proxy in bootstrap process

CLI changes:
- Update ov chat endpoint to /bot/v1/chat
- Fix UTF-8 input handling
- Add endpoint configuration via env var
- Enhance tool registry with better error handling
- Update OpenAPI channel configuration
- Improve session manager with better state handling
- Enhance Langfuse tracing integration with diagnostic logging
- Enhance CLI commands with new agent tool integration
- Move plugin analysis doc to docs directory
- Add RFC for OpenViking CLI ov-chat command
- Add server restart script

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Collaborator

@MaojiaSheng MaojiaSheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

信仰之跃

@MaojiaSheng MaojiaSheng merged commit 1b17534 into main Mar 4, 2026
25 of 27 checks passed
@MaojiaSheng MaojiaSheng deleted the feature/vikingbot_opt branch March 4, 2026 12:48
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants